package com.deuwise.job.customquartz;

import com.deuwise.common.utils.SpringContextHolder;
import com.deuwise.job.customquartz.base.JobRun;
import com.deuwise.job.customquartz.base.JobRunLogHelper;
import com.deuwise.job.entity.JobRunLogDo;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.context.ApplicationContext;

/**
 * @author chenwenchao
 * @date 2018/5/07 Description:
 * <p>
 * 定时测试类
 */

public class JobDemo3  implements Job,JobRun {


    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        //添加执行日志
        System.out.println("JobDemo3：启动任务=======================");
        /*
         * 添加运行日志
         *
         * */
      JobRunLogHelper jobRunLogHelper= SpringContextHolder.getBean(JobRunLogHelper.class);
      JobRunLogDo jobRunLogDo=new JobRunLogDo();
      jobRunLogHelper.getBaseRunLog(context,jobRunLogDo, this.getClass());

    }

    @Override
    public void run() {
        ApplicationContext applicationContext = SpringContextHolder.getApplicationContext();
        System.out.println("JobDemo3：执行完毕=======================");

    }
}
